<!DOCTYPE html>
<title>This tests that a mouse click event will cause a media element to gain focus.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="media-controls.js"></script>
<video controls></video>
<script>
test(function() {
    var video = document.querySelector("video");
    var rect = video.getBoundingClientRect();
    // Click on the center of the video element.
    var x = rect.left + rect.width / 2;
    var y = rect.top + rect.height / 2;
    eventSender.mouseMoveTo(x, y);
    eventSender.mouseDown();
    eventSender.mouseUp();
    assert_equals(document.activeElement, video);

    // Click on the play button.
    mediaControlsButton(video, "play-button").click();
    assert_equals(document.activeElement, video);
});
</script>
